<?php
namespace app\admin\controller;
use think\Controller;
use app\admin\model\Admin; 
use app\admin\model\Use1; 
use think\facade\Session;
use think\captcha\Captcha;
class Login extends Controller{
	public function login(){
		
			return $this->fetch();
		
		
	}
	public function denglu(){
		
		$user = new Admin();
		$data = input('post.');
		
		if(captcha_check(input('post.yzm'))){		
		
		$list = $user->user();
		if($list){
			Session::set('a_name',$data['a_name']);
			
			$list = Admin::where(['a_name'=>input('param.a_name')])->select();
			
			
			
			
			$list1 = Use1::where(['u_id'=>$list[0]['a_type']])->select();
			//halt($list1[0]['u_type']);
			Session::set('u_type',$list1[0]['u_type']);
			Session::set('l_id',$list1[0]['l_id']);
			//halt($list1);
		
		
		
		
		
			
			$this->success("登陆成功","index/index");
		}
		else{
			$this->error('登录失败',"login/login");
		}
		}else{
			$this->error('验证码错误，请重新登录',"login/login");
		}
	}
}
?>